package org.dhis2.usescases.enrollment

import androidx.test.ext.junit.runners.AndroidJUnit4
import androidx.test.rule.ActivityTestRule
import org.dhis2.commons.prefs.Preference
import org.dhis2.usescases.BaseTest
import org.dhis2.usescases.searchTrackEntity.SearchTEActivity
import org.junit.Rule
import org.junit.Test
import org.junit.runner.RunWith

@RunWith(AndroidJUnit4::class)
class EnrollmentTest : BaseTest() {

    @get:Rule
    val ruleSearch = ActivityTestRule(SearchTEActivity::class.java, false, false)

    @get:Rule
    val ruleEnrollment = ActivityTestRule(EnrollmentActivity::class.java, false, false)

    @Test
    fun shouldShowDateEditionWarningMessage() {
        setupCredentials()
        setDatePicker()
        prepareTeiWithAutogeneratedEvents(ruleEnrollment)

        enrollmentFormRobot {
            clickOnDateOfBirth()
            changePickerDate()
            clickOnAcceptEnrollmentDate()
            checkDateWarningIsDisplayed()
        }
    }
}
